<?php

namespace Admin\Api\Controllers;

use Helpers\Main;
use Modules\Power;
use Phalcon\Paginator\Adapter\QueryBuilder;

class PowerController extends ControllerBase
{



    public function getUserPowerAction()
    {
        if (!$this->request->isPost()){
            return $this->sendErrorResponse(400, '请求方式不正确');
        }
        $body   = $this->request->getJsonRawBody(true);
        $userId = $body['userId'];
        if (!is_numeric($userId)) {
            return $this->sendErrorResponse(400, '用户不正确');
        }
        try {
//            $data = \Helpers\UserPower::getInterfaceUserPowerTags($userId);
            $data = Power::getPowerTags($userId);
            return $this->response->setJsonContent($data);
        }
        catch (\Exception $e) {
            return $this->sendErrorResponse(500, '获取失败', $e->getMessage());
        }
    }

}

